<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" >

    <ui:composition template="./template.xhtml">
        <ui:define name="titulo">Cadastro Aluno</ui:define>
        <ui:define name="tela">
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="RA" />
                    <h:inputText value="#{alunoController.aluno.ra}" >
                        <f:converter converterId="raConverter" />
                    </h:inputText>

                    <h:outputLabel value="Nome" />
                    <h:inputText value="#{alunoController.aluno.nome}" />
                </h:panelGrid>

                <h:commandButton value="Salvar" action="#{alunoController.salvar}" />
                <h:commandLink value="Limpar" immediate="true" action="#{alunoController.limpar}" />
                <h:commandLink value="Voltar" immediate="true" action="PRINCIPAL" />
            </h:form>

            <h:form>
                <rich:dataTable var="aluno" value="#{alunoController.alunoList}" >
                    <f:facet name="header">
                        <rich:columnGroup>
                            <rich:column>
                                <h:outputLabel value="RA" />
                            </rich:column>
                            <rich:column>
                                <h:outputLabel value="Nome" />
                            </rich:column>
                        </rich:columnGroup>
                    </f:facet>
                    <rich:column>
                        <h:outputLabel value="#{aluno.ra}" >
                            <f:converter converterId="raConverter" />
                        </h:outputLabel>
                    </rich:column>
                    <rich:column>
                        <h:outputLabel value="#{aluno.nome}" />
                    </rich:column>
                    <rich:column>
                        <h:commandLink value="Alterar"
                                       actionListener="#{alunoController.editar}" >
                            <f:attribute name="parametro" value="#{aluno}" />
                        </h:commandLink>
                    </rich:column>
                </rich:dataTable>
            </h:form>
        </ui:define>
    </ui:composition>

</html>